<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <p>{{time | showTime}}</p>
    </div>
</body>
<script>
    const app = new Vue({
        el: "#app",
        data: {
            time: Date.now()
        },
        mounted() {
            window.setInterval(() => {
                this.time = Date.now();
            }, 1000)
        },
        filters: {
            showTime(value) {
                const d = new Date(value);
                const y = d.getFullYear();
                const m = d.getMonth() + 1;
                const day = d.getDate();
                const h = d.getHours();
                const ms = d.getMinutes();
                const s = d.getSeconds();
                return `${y}年${m}月${day},${h}:${ms}:${s}`
            }
        }
    })
</script>

</html>